<!-- inc:frame.top -->

<script language="Javascript" src="js/sort.js"></script>
<style>
select:-internal-list-box option:checked, option:hover, option:checked { background-color:#ddd !important;}
</style>
<div class="position"><p><!-- inc:position --> &raquo; <a href="{:$mainlink}?file=sysgroup&act=list">管理系统组</a> &raquo; {:$groupname} &raquo; <a href="{:$mainlink}?file=sysgroup&act=fieldlist&sysgroupid={:$sysgroupid}">字段管理</a> &raquo; <a href="{:$mainlink}?file=sysgroup&act=fieldgroup&sysgroupid={:$sysgroupid}">字段方案管理</a> &raquo; <!-- if($act=="fieldgroupadd") -->添加字段方案<!-- elseif($act=="fieldgroupmodify") -->编辑字段方案<!-- end --></p><!-- inc:position.fr --></div>

<div class="page_pad">
  <form method="post" action="{:$mainlink}?file=sysgroup&act=fieldgroupsetok&sysgroupid={:$sysgroupid}" name="productsTypeActionForm" onsubmit="return chkset(this);">
  <input type="hidden" name="id" value="{:$id}" />
  <div class="content_box">
    <div class="content_bor">
      <table class="ctable">
        <tr>
          <td class="left">字段方案名称：<span style="color:red;">*</span></td>
          <td class="right">
            <input class="ginput" type="text" name="groupname" value="{:$rs[groupname]}" />
            &nbsp;
            [简单描述方案名称]
          </td>
        </tr>
        <tr>
          <td class="left">包含字段：</td>
          <td class="right">
            <table class="ftable">
              <tr>
                <td>
                  <select multiple="" name="updownlist" id="updownlist" style="width:300px;" size="14">
                  <!-- $field_sel AS $key=>$value -->
                  <option value="{:$value[id]}" {if($value[selected])}selected{end}>{:$value[field_name]}</option>
                  <!-- end -->
                  </select>
                </td>
                <td>
                  <div class="order_button">
                    <div><button class="gbutton" id="button" onclick="moveOptionFirst(this.form.updownlist)" type="button" name="button">▲放置最首</button></div>
                    <div><button class="gbutton" onclick="moveOptionUp(this.form.updownlist)" type="button" name="button">↑向上移动</button> <button class="gbutton" onclick="moveOptionDown(this.form.updownlist)" type="button" name="button">↓朝下移动</button></div>
                    <div><button class="gbutton" id="button" onclick="moveOptionLast(this.form.updownlist)" type="button" name="button">▼移动最底</button></div>
                    <div><button class="gbutton" id="button" onclick="moveOptionUpSideDown(this.form.updownlist)" type="button" name="button">▲倒序排列</button></div>
                  </div>
                </td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td class="left">所有字段：</td>
          <td class="right">
            <select multiple="" id="allfield" style="width:300px;" size="14">
              <!-- if($field) -->
              <!-- $field AS $key=>$value -->
              <option {if($value[selected])}style="background-color:#ddd"{end} value="{:$value[id]}" onclick="addselect(this)">{:$value[field_name]}</option>
              <!-- end -->
              <!-- end -->
            </select>
          </td>
        </tr>
      </table>
    </div>
  </div><!--content_box-->
  <input name="listlayer" type="hidden" />
  
  <div class="gbutton_div"><button type="submit" class="gbutton gbutton_dblue gbutton_add" id="creat_button">确认</button> &nbsp; <button type="button" class="gbutton gbutton_add" onclick="qgurl('{:$mainlink}?file=sysgroup&act=fieldgroup&sysgroupid={:$sysgroupid}')">返回</button> &nbsp; <span id="show_step" style="color:red;"><img src="images/loading.gif" style="visibility:hidden;" /></span></div>
  </form>
</div><!--page_pad-->

<script language="JavaScript">
function addselect(o)
{
	uhtml = "";
	flag = false;
	var ulist = document.getElementById("updownlist");
	for(i=0;i<ulist.options.length;i++){
		if(ulist.options[i].value == o.value)
		{
			flag = true
		}
	}
	if(flag)
	{
		o.style.backgroundColor="#fff";
		for(i=0;i<ulist.options.length;i++){
			if(ulist.options[i].value != o.value)
			{
				uhtml += '<option value="'+ulist.options[i].value+'">'+ulist.options[i].innerHTML+'</option>';
			}
		}
	}
	else
	{
		o.style.backgroundColor="#ddd"
		for(i=0;i<ulist.options.length;i++){
			uhtml += '<option value="'+ulist.options[i].value+'">'+ulist.options[i].innerHTML+'</option>';
		}
		uhtml = uhtml+'<option value="'+o.value+'">'+o.innerHTML+'</option>';
	}
	document.getElementById("updownlist").innerHTML=uhtml;
}
function chkset(o)
{
	var j =  new Array(o.updownlist.options.length);
	for(i=0;i<o.updownlist.options.length;i++)
	{
		j[i] = o.updownlist.options[i].value+",";    
	}
	
	var g = "";
	for(i=0;i<j.length;i++)
	{
		g = g+j[i];
	}
	document.productsTypeActionForm.listlayer.value=g;
	
	if(!o.groupname.value)
	{
		tip_msg("字段方案名称不能为空！");
		return false;
	}
	document.getElementById("show_step").innerHTML = "<img src='images/loading.gif' border='0' align='absmiddle'> 正在保存数据，如果网页没有动静请刷新...";
	document.getElementById("creat_button").disabled=true;
}
</script>

<!-- inc:frame.bottom -->